<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>发货单信息</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
  <script type="text/javascript">
  //编写自定义JS代码
  window.onload = function(){

      var zt=$('#zt').text();
      if(zt="是"){
          // $('#shUser').hide();
          // $('#shAddress').hide();
          $('#ztWarehouse').show();
	  }else{
          // $('#shUser').show();
          // $('#shAddress').show();
          $('#ztWarehouse').hide();
	  }

  }


  function doUpdate(){
      var deliverStatus=$('#deliverStatus').text();
      var deliverid=$('#deliverId').val();
      var deliverType=$('#deliverType').val();
      var soCode=$('#soCodeId').val();
      var equipment=[];
      $('#updateEquipment table').each(function(){
          var obj={};
          obj.deliverEquipmentId=$(this).find('input[name="deliverEquipmentId"]').val();
          obj.equipmentTypeId=$(this).find('select[name="equipmentType"] option:selected').val();
          obj.itemId=$(this).find('select[name="equipmentItem"] option:selected').val();
          obj.total=$(this).find('input[name="total"]').val();
          obj.isReturn=$(this).find('select[name="isReturn"] option:selected').val();
          obj.sn=$(this).find('input[name="sn"]').val();
          obj.memo=$(this).find('textarea[name="memo"]').val();
          obj.applyLayer=$(this).find('select[name="applyLayer"] option:selected').val();
          equipment.push(obj)
          console.log(obj);
          //alert("obj:"+equipment);
      });
      $.ajax({
          type:"POST",
          data:{'deliverStatus':deliverStatus,'deliverType':deliverType,'deliverid':deliverid,'soCode':soCode,'equipment':JSON.stringify(equipment)},
          url:"cbsDelinerController.do?doUpdate",
          dataType:"json",
          success:function (data) {
              alert("data:"+data);
              jQuery.messager.confirm('提示:','确定要更改吗?',function(event){
                  if(event){
                      tip("更改成功");
                      setTimeout(" window.location.href='cbsDelinerController.do?cbsDeliner'",1000);
                  }else{
                      // alert("你点击的是false");
                  }
              });
          }
      })
  }
  </script>
 </head>
 <body>
 <div  style="margin-bottom:10px;">
	 <input hidden="hidden" id="deliverId" value="${cbsDelinerPage.id}">
	 <img style="margin-bottom:-7px" src="plug-in/login/images/dispatch bill.png">
	 <span class="list-title">${cbsDelinerPage.code}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	 <span style="font-size:13px;">状态：<span id="deliverStatus" class="color-red">${deliverStatus.typename}</span></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	 <span >已欠货时长:
			 <span class="color-red">${qhtime}</span>
	 </span>
	 <div style="position: absolute; text-align: center; width: 100%; margin-top:-20px;">
		 <a href="cbsDelinerController.do?cbsDeliner" class="easyui-linkbutton l-btn">保存</a>
	 </div>
 </div>

 <div class="subtitle">
	 <p>关联信息</p>
	 <table class="nobordertable noborder">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>服务单号CR:</label>
			 </td>
			 <td width="30%">
				 ${cbsService.code}
			 </td>
			 <td class="al_r" width="20%">
				 <label>备件申请单号:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.equipmentApplyId.recordId}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>SR:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.srCode}
			 </td>
			 <td class="al_r" width="20%">
				 <label>SO:</label>
			 </td>
			 <td width="30%">
				 <input readonly="readonly" hidden="hidden" id="soCodeId" value="${cbsDelinerPage.soCode}">
				 <label>${cbsDelinerPage.soCode}</label>
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>发货单类型:</label>
			 </td>
			 <td width="30%">
				 <c:forEach items="${deliverTypeList}" var="tsType">
					 <c:if test="${tsType.typecode==cbsDelinerPage.deliverType}">
						 <label>${tsType.typename}</label>
					 </c:if>
				 </c:forEach>
			 </td>
			 <td class="al_r" width="20%">

			 </td>
			 <td width="30%">

			 </td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 <div class="subtitle">
	 <p>发货申请</p>
	 <div id="updateEquipment">
	 <c:forEach items="${deliverEquipmentList}" var="deliverEquipment">
	 <div class="l-div deliverEquipment">
		 <input type="checkbox" />
		 <table class="nobordertable noborder" style="border: 1px;">
			 <input name="deliverEquipmentId" type="hidden" value="${deliverEquipment.id}">
			 <tbody>
				 <tr>
					 <td class="al_r" width="20%">
						 <label>备件类型:</label>
					 </td>
					 <td width="30%">
						 <label>${deliverEquipment.typeDes.typeDesc}</label>
					 </td>
					 <td class="al_r" width="20%">
						 <label>备件号:</label>
					 </td>
					 <td width="30%">
						 <label>${deliverEquipment.item.item}</label>
					 </td>
				 </tr>
				 <tr>
					 <td class="al_r" width="20%">
						 <label>数量:</label>
					 </td>
					 <td width="30%">
						 <label>${deliverEquipment.total}</label>
						 <input readonly="readonly" hidden="hidden" name="total"  value="${deliverEquipment.total}"/>
					 </td>
					 <td class="al_r" width="20%">
						 <label>申请优先级:</label>
					 </td>
					 <td width="30%">
								 <c:if test="${1==deliverEquipment.applyLayer}">
									 <label>低</label>
								 </c:if>
								 <c:if test="${2==deliverEquipment.applyLayer}">
									 <label>中</label>
								 </c:if>
								 <c:if test="${3==deliverEquipment.applyLayer}">
									 <label>高</label>
								 </c:if>
								 <c:if test="${4==deliverEquipment.applyLayer}">
									 <label>加急</label>
								 </c:if>

					 </td>
				 </tr>
				 <tr>
					 <td class="al_r" width="20%">
						 <label>是否返件:</label>
					 </td>
					 <td width="30%">
							 <c:if test="${deliverEquipment.isReturn=='1'}">
								 <label>否</label>
							 </c:if>
							 <c:if test="${deliverEquipment.isReturn=='2'}">
								 <label>是</label>
							 </c:if>
					 </td>
					 <td class="al_r" width="20%">
						 <label>发货备件序列号:</label>
					 </td>
					 <td width="30%">
						 <label>${deliverEquipment.sn}</label>
					 </td>
				 </tr>
				 <tr>
					 <td class="al_r" width="20%">
						 <label>备件描述:</label>
					 </td>
					 <td width="30%">
						 <label>${deliverEquipment.memo}</label>
						 <textarea name="memo" hidden="hidden" readonly="readonly" style="width: 100%; height: 80px;" placeholder="${deliverEquipment.memo}"></textarea>
					 </td>
					 <td class="al_r" width="20%">
						 <label>申请理由:</label>
					 </td>
					 <td width="30%">
						 ${cbsDeliner.equipmentApplyId.applyReason}
					 </td>
				 </tr>
			 </tbody>
		 </table>
	 </div>
	 </c:forEach>
	 </div>
	 <div style="text-align: center;">
		 <%--<a href="#" class="easyui-linkbutton l-btn">发货</a>--%>
		 <%--<a href="#" class="easyui-linkbutton l-btn">标记欠货</a>--%>
	 </div>
	 <div style="margin-top:20px; width: 98%; margin: 10px auto;"><span style="font-weight: bold;">说明</span></div>
	 <div class="line"></div>
	 <table class="nobordertable noborder" style="border: none;">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>发货说明:</label>
			 </td>
			 <td width="30%">
				 <label>${cbsDelinerPage.deliverDes}</label>
				 <textarea readonly="readonly" hidden="hidden" style="width: 100%; height: 80px;" placeholder="${cbsDelinerPage.deliverDes}"></textarea>
			 </td>
			 <td class="al_r" width="20%">
				 <label>附件:</label>
			 </td>
			 <td width="30%">
				 <span class="color-blue">aa1231232131.jpg</span>
			 </td>
			 <td class="al_r" width="20%">

			 </td>
			 <td width="30%">

			 </td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 <div class="subtitle">
	 <p>收货人信息</p>
	 <table class="nobordertable noborder" style="border: none;">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>是否自提:</label>
			 </td>
			 <td colspan="3">
				 <c:if test="${cbsDelinerPage.zt==1}">
					 <span id="Zt">是</span>
				 </c:if>
				 <c:if test="${cbsDelinerPage.zt==2}">
					 <span id="Zt">否</span>
				 </c:if>
			 </td>
		 </tr>
		 <tr id="shUser">
			 <td class="al_r" width="20%">
				 <label>姓名:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.userName}
			 </td>
			 <td class="al_r" width="20%">
				 <label>电话:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.phone}
			 </td>
		 </tr>
		 <tr id="shAddress">
			 <td class="al_r" width="20%">
				 <label>收货地址:</label>
			 </td>
			 <td width="30%">
				 <c:if test="${cbsDelinerPage.sheng !=null}">
					 ${cbsDelinerPage.sheng.territoryName}
				 </c:if>
				 <c:if test="${cbsDelinerPage.shi !=null}">
					 ${cbsDelinerPage.shi.territoryName}
				 </c:if>
				 <c:if test="${cbsDelinerPage.address !=null}">
					 ${cbsDelinerPage.address}
				 </c:if>
			 </td>
			 <td class="al_r" width="20%">
				 <label>影院名称:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.cinemaName}
			 </td>
		 </tr>
		 <tr id="ztWarehouse">
			 <td class="al_r"><label>自提仓库:</label></td>
			 <td colspan="3">
				 <span>${cbsDelinerPage.warehouseId.sheng.territoryName}</span>
				 &nbsp;&nbsp;
				 <span>${cbsDelinerPage.warehouseId.name}</span>
			 </td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 <div class="subtitle">
	 <p>物流</p>
	 <table class="nobordertable noborder" style="border: none;">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>发货物流:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.deliverLogistics}
			 </td>
			 <td class="al_r" width="20%">
				 <label>联系人:</label>
			 </td>
			 <td width="30%">
				 ${zyContacts.name}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>电话:</label>
			 </td>
			 <td width="30%">
				 ${zyContacts.cellphone1}
			 </td>
			 <td class="al_r" width="20%">
				 <label>邮箱:</label>
			 </td>
			 <td width="30%">
				 ${zyContacts.email}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>发货SLA:</label>
			 </td>
			 <td width="30%">
				 ${fhSLA.typename}
			 </td>
			 <td class="al_r" width="20%">
				 <label>提货地址:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.thAddress}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>仓库:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.deliverWarehouseId.name}
			 </td>
			 <td class="al_r" width="20%">
				 <label>库位:</label>
			 </td>
			 <td width="30%">
				${kuwei.typename}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>预计到货时间:</label>
			 </td>
			 <td width="30%">
				 <fmt:formatDate value="${cbsDelinerPage.expectTime}" type="date" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>

			 </td>
			 <td class="al_r" width="20%">
				 <label>物流单号:</label>
			 </td>
			 <td width="30%">
				 123123123&nbsp;&nbsp;<span  hidden="hidden"  class="color-blue">[查看物流]</span>
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" valign="top"><label>物流发货备注:</label></td>
			 <td colspan="3">
				 <textarea readonly="readonly" style="width:100%; height: 60px;"></textarea>
			 </td>
		 </tr>
		 </tbody>
	 </table>
	 <table class="nobordertable noborder" style="border: none;">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>返件物流:</label>
			 </td>
			 <td width="30%">
				 ${cbsDelinerPage.returnLogistics}
			 </td>
			 <td class="al_r" width="20%">
				 <label>联系人:</label>
			 </td>
			 <td width="30%">
				 ${returnContacts.name}
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>电话:</label>
			 </td>
			 <td width="30%">
				 ${returnContacts.cellphone1}
			 </td>
			 <td class="al_r" width="20%">
				 <label>邮箱:</label>
			 </td>
			 <td width="30%">
				 ${returnContacts.email}
			 </td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 <div class="subtitle">
	 <p>签收</p>
	 <table class="nobordertable noborder" style="border: none;">
		 <tbody>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>签收方式:</label>
			 </td>
			 <td width="30%">
				 自提
			 </td>
			 <td class="al_r" width="20%">
				 <label>签收时间:</label>
			 </td>
			 <td width="30%">
				 2017-02-22
			 </td>
		 </tr>
		 <tr>
			 <td class="al_r" width="20%">
				 <label>物流单照片:</label>
			 </td>
			 <td width="30%">
				 <span class="color-blue">12312k2jk12j3.jpg</span>
			 </td>
			 <td class="al_r" width="20%">
				 <label>签收备注:</label>
			 </td>
			 <td width="30%">
				 小西天电影城签收
			 </td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 <div class="subtitle">
	 <p>日志</p>
	 <table class="ftable">
		 <tbody>
		 <tr>
			 <th>操作人</th>
			 <th>时间</th>
			 <th>描述</th>
		 </tr>
		 <tr>
			 <td>刘xx</td>
			 <td>2017-02-03</td>
			 <td>发货异常：已取消发货</td>
		 </tr>
		 </tbody>
	 </table>
 </div>
 </body>
  <script src = "webpage/com/zybk/com.deli/cbsDeliner.js"></script>		